//
//  UIButton+QuickSettings.m
//  
//
//  Created by tianliwei on 13-4-16.
//  Copyright (c) 2013年  田立伟. All rights reserved.
//

#import "UIButton+QuickSettings.h"

@implementation UIButton (QuickSettings)
+ (UIButton *)buttonWithTag:(NSInteger)tag frame:(CGRect)frame normalImage:(UIImage *)normalImage highlightedImage:(UIImage *)highlightedImage target:(id)target action:(SEL)action{
    UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
    [button setTag:tag];
    [button setFrame:frame];
    [button.titleLabel setFont:[UIFont systemFontOfSize:18.0]];
    [button setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
    [button setBackgroundImage:normalImage forState:UIControlStateNormal];
    [button setBackgroundImage:highlightedImage forState:UIControlStateSelected];
    [button setBackgroundImage:highlightedImage forState:UIControlStateHighlighted];
    [button setBackgroundImage:highlightedImage forState:UIControlStateHighlighted|UIControlStateSelected];
    [button addTarget:target action:action forControlEvents:UIControlEventTouchUpInside];
    return button;
}

+ (UIButton *)buttonWithTag:(NSInteger)tag frame:(CGRect)frame title:(NSString *)title fontSize:(NSInteger)size color:(UIColor *)color target:(id)target action:(SEL)action{
    UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
    [button setTag:tag];
    [button setFrame:frame];
    [button setTitle:title forState:UIControlStateNormal];
    [button setTitleColor:color forState:UIControlStateNormal];
    [button.titleLabel setFont:[UIFont boldSystemFontOfSize:size]];
    [button addTarget:target action:action forControlEvents:UIControlEventTouchUpInside];
    return button;
}

@end
